import ToastComponent from './toast.vue'
const Toast={}
Toast.install=function(Vue,options){
    const ToastConstructor=Vue.extend(ToastComponent)
    const instance=new ToastConstructor()
    instance.$mount(document.createElement('div'))
    document.body.appendChild(instance.$el)
    Vue.prototype.$toast=function(msg,duration=2000){
        instance.msg=msg
        instance.show=true
        setTimeout(() => {
           instance.show=false 
        }, duration);
    }
}
export default Toast
